﻿using System;
using System.Diagnostics;

namespace ProcessMonitor {
  class CPUMonitor {
    static void Main(string[] args) {
      string argument = "";
      for (int i = 1; i < args.Length; i++) {
        argument += args[i] + " ";
      }
      ProcessStartInfo info = new ProcessStartInfo(args[0]);
      info.UseShellExecute = false;
      info.Arguments = argument;
      Process p = Process.Start(info);
      DateTime stime = p.StartTime;
      p.WaitForExit();
      DateTime etime = p.ExitTime;
      Console.WriteLine("User Processor Time : " + p.UserProcessorTime);
      Console.WriteLine("Total Processor Time: " + p.TotalProcessorTime);
      Console.WriteLine("Execution Time      : " + (etime - stime));
    }
  }
}
